export const columns = [
  {
    title: '任务编码',
    dataIndex: 'name',
    width: 120,
    key: 'name',
  },
  {
    title: '任务类型',
    dataIndex: 'type',
    width: 80,
    key: 'type',
    customRender: ({ record }) => {
      const typeMap = {
        ROLLING: '滚动升级',
        RECREATE: '替换升级',
        GRAY: '灰度升级',
        BLUEGREEN: '蓝绿升级',
      };
      return typeMap[record.type];
    },
  },
  {
    title: '应用',
    dataIndex: 'appName',
    width: 80,
    key: 'appName',
  },
  {
    title: '企业名称',
    dataIndex: 'tenantName',
    width: 160,
    key: 'tenantName',
  },
  {
    title: '套餐类型',
    dataIndex: 'instanceType',
    width: 80,
    key: 'instanceType',
  },
  {
    title: '组件',
    dataIndex: 'componentName',
    width: 120,
    key: 'componentName',
  },
  {
    title: '升级前版本',
    dataIndex: 'previousVersion',
    width: 80,
    key: 'previousVersion',
  },
  {
    title: '升级后版本',
    dataIndex: 'currentVersion',
    width: 80,
    key: 'currentVersion',
  },
  {
    title: '状态',
    dataIndex: 'status',
    width: 80,
    key: 'status',
    customRender: ({ record }) => {
      const statusMap = {
        SUCCESSFUL: '成功',
        FAILED: '失败',
        RUNNING: '执行中',
        TASK_BACK: '已回退',
      };
      return statusMap[record.status];
    },
  },
  {
    title: '执行时长',
    dataIndex: 'duration',
    width: 60,
    key: 'duration',
  },
  {
    title: '操作',
    key: 'operation',
    width: 150,
  },
];

export const grayParamColumns = [
  {
    title: 'Headers过滤项',
    dataIndex: 'headersField',
    key: 'headersField',
  },
  {
    title: '匹配方式',
    width: '150px',
    dataIndex: 'type',
    key: 'type',
  },
  {
    title: '匹配规则',
    dataIndex: 'pattern',
    key: 'pattern',
  },
  {
    title: '新版本路由权重',
    dataIndex: 'weight',
    key: 'weight',
  },
  {
    title: '路由策略优先级',
    dataIndex: 'precedence',
    key: 'precedence',
  },
  {
    title: '操作',
    key: 'operation',
    width: '100px',
  },
];
